package com.smart.common.config.weixin;

import cn.hutool.core.util.StrUtil;
import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage;
import me.chanjar.weixin.open.api.impl.WxOpenOAuth2ServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 微信开放平台配置初始化
 *
 * @author Administrator
 */
@Configuration
@ConditionalOnClass
public class WxOpenConfiguration {

    /**
     * 微信支付配置服务
     *
     * @return {@code WxPayService}
     */
    @Bean
    @ConditionalOnMissingBean
    public WxOpenOAuth2ServiceImpl init() {


        WxOpenInMemoryConfigStorage wxOpenInMemoryConfigStorage = new WxOpenInMemoryConfigStorage();
        return new WxOpenOAuth2ServiceImpl(StrUtil.EMPTY, StrUtil.EMPTY,wxOpenInMemoryConfigStorage);


    }


}
